package com.jlpay.openapi.demo.trans.mini.wx;


import com.jlpay.open.jlpay.sdk.java.model.BaseResponse;
import com.jlpay.open.jlpay.sdk.java.model.trans.mini.wx.request.AuthBindRequest;
import com.jlpay.open.jlpay.sdk.java.model.trans.mini.wx.response.OfficialPayResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author dengwenning
 * @since 2024/9/23
 **/
public class AuthBindService {
    private static final Logger LOGGER = LoggerFactory.getLogger(AuthBindService.class);

    public static void main(String[] args) {
        AuthBindRequest authBindRequest = buildAuthBindRequest();
        BaseResponse authBindResponse = JlpayOpenApiService.openMerchService()
                .post(authBindRequest, OfficialPayResponse.class);
        LOGGER.info("微信公众号/小程序绑定支付目录响应:{}", JsonUtils.toString(authBindResponse));
    }

    private static AuthBindRequest buildAuthBindRequest() {
        AuthBindRequest authBindRequest = new AuthBindRequest();

        authBindRequest.setMchId("849584358120018");
        authBindRequest.setPayType("wxpay");
        authBindRequest.setJsapiPath("http://wx.com/jspay/pay/");
        authBindRequest.setSubAppid("wxd930ea53421a258f4f");
        authBindRequest.setMchCreateIp("123.12.12.123");

        return authBindRequest;
    }

}
